#ifndef FKAPPVERSIONMODEL_H
#define FKAPPVERSIONMODEL_H

#include "FKQuickRowModel.h"

class FKAppVersionModel : public FKQuickRowModel{
    Q_OBJECT
    Q_PROPERTY(qint64 totalDownloaded MEMBER _totalDownloaded NOTIFY totalDownloadedChanged)
    Q_PROPERTY(QString totalDownloadedLbl MEMBER _totalDownloadedLbl NOTIFY totalDownloadedLblChanged)
    Q_PROPERTY(qint64 totalDownload MEMBER _totalDownload NOTIFY totalDownloadChanged)
    Q_PROPERTY(QString totalDownloadLbl MEMBER _totalDownloadLbl NOTIFY totalDownloadLblChanged)
    Q_PROPERTY(QString filteringExpr MEMBER _filteringExpr)
public:
    FKAppVersionModel(QObject *parent = 0);
    ~FKAppVersionModel();
    QHash<int,QByteArray> roleNames() const;
    void refreshDownloadedWeights();
    void refreshDownloadWeights();
    static QString bytesToLabelText(const qint64 &bytes);
public slots:
    void setDownloaded(const QString &file, const quint8 &osType,const qint64 &size);
    void setDownloadComplete(const QString &file,const quint8 &osType,const bool &success);
signals:
    void totalDownloadedChanged(const qint64 &val);
    void totalDownloadedLblChanged(const QString &lbl);
    void totalDownloadChanged(const qint64 &val);
    void totalDownloadLblChanged(const QString &lbl);
private slots:
    void internalDataChanged(const QModelIndex &topLeft,
                             const QModelIndex &bottomRight,
                             const QVector<int> &roles);
private:
    qint64 _totalDownloaded;
    QString _totalDownloadedLbl;
    qint64 _totalDownload;
    QString _totalDownloadLbl;
    QString _filteringExpr;
};

#endif // FKAPPVERSIONMODEL_H
